<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>轻量商城 安装向导 - 检测安装环境</title>
    <link href="<?=base_url()?>install/templates/style/install.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="<?=base_url()?>install/templates/js/jquery.min.js"></script>
    <script type="text/javascript" src="<?=base_url()?>install/templates/js/common.js"></script>
</head>

<body>
    <div class="header"><span style="color: rgb(86, 83, 245);">轻量商城</span> | 安装向导</div>
    <div class="mainBody">
        <div class="forms">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr align="left" class="head">
                    <td width="30%" height="36">项目</th>
                    <td width="30%">所需配置</th>
                    <td width="15%">推荐配置</th>
                    <td width="25%" align="right">当前服务器</th>
                </tr>
                <tr>
                    <td height="26" class="firstCol">操作系统</td>
                    <td>不限制</td>
                    <td>Linux</td>
                    <td class="endCol"><?= htmlspecialchars(PHP_OS) ?></td>
                </tr>
                <tr>
                    <td height="26" class="firstCol">PHP 版本</td>
                    <td>8.0</td>
                    <td>8.0</td>
                    <td class="endCol"><?=$php_v?></td>
                </tr>
                <tr>
                    <td height="26" class="firstCol">附件上传</td>
                    <td>2M</td>
                    <td>2M</td>
                    <td class="endCol"><?= get_cfg_var("upload_max_filesize") ?: '不允许上传附件' ?></td>
                </tr>
                <tr>
                    <td height="26" class="firstCol">GD 库</td>
                    <td>2.0</td>
                    <td>2.1</td>
                    <td class="endCol"><?=$gd_v?></td>
                </tr>
                <tr>
                    <td height="26" class="firstCol">磁盘空间</td>
                    <td>100M</td>
                    <td>不限制</td>
                    <td class="endCol">
                        <?= htmlspecialchars($disk)?>
                    </td>
                </tr>
            </table>
            <div class="hr_10"></div>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr align="left" class="head">
                    <td width="60%" height="36">扩展要求
                        </th>
                    <td width="25%">检查结果
                        </th>
                    <td width="15%" align="right">建议
                        </th>
                </tr>
                <?php foreach ($extendArray as $item) { ?>
                    <tr>
                        <td height="26" class="firstCol"><?= $item['name'] ?></td>
                        <td><?= $item['status'] ? '支持' : '不支持' ?></td>
                        <td class="endCol">
                            <span class="<?= $item['status'] ? '' : 'col-red' ?>"><?= $item['status'] ? '无' : '需安装' ?></span>
                        </td>
                    </tr>
                <?php } ?>
            </table>
            <div class="hr_10"></div>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr align="left" class="head">
                    <td width="60%" height="36">函数名称
                        </th>
                    <td width="25%">检查结果
                        </th>
                    <td width="15%" align="right">建议
                        </th>
                </tr>
                <?php foreach ($exists_array as $v) { ?>
                    <tr>
                        <td height="26" class="firstCol"><?= $v['f'] ?>()</td>
                        <td><?= $v['s'] ? '支持' : '不支持' ?></td>
                        <td class="endCol"><?= $v['t'] ?></td>
                    </tr>
                <?php } ?>
            </table>
            <div class="hr_10"></div>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr align="left" class="head">
                    <td width="60%" height="36">文件权限检测
                        </th>
                    <td width="25%">所需状态
                        </th>
                    <td width="15%" align="right">当前状态
                        </th>
                </tr>
                <?php
                foreach ($iswrite_array as $v) {
                ?>
                    <tr align="left">
                        <td height="26" class="firstCol"><?= $v['f'] ?></td>
                        <td>可写</td>
                        <td class="endCol"><?= $v['t'] ?></td>
                    </tr>
                <?php
                }
                ?>
            </table>
        </div>
    </div>
    <div class="footer">
        <span class="step2"></span>
        <span class="copyright"><?= $cfg_copyright ?></span>
        <span class="formSubBtn">
            <form class="j-form" method="post" action="?s=2">
                <a href="javascript:void(0);" onclick="history.go(-1);return false;" class="back">返 回</a>
                <a href="javascript:void(0);" class="j-submit submit">下一步</a>
                <input type="hidden" name="s" id="s" value="2">
            </form>
        </span>
    </div>
    <script>
        $(function() {
            // 环境检测是否通过
            var isPass = <?= $isNext ? 'true' : 'false' ?>;
            console.log(isPass)
            // 表单提交
            $('.j-submit').click(function() {
                if (isPass) {
                    $('.j-form').submit();
                } else {
                    alert('环境检测不通过，请先修复');
                }
            })
        })
    </script>
</body>

</html>